<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
<title>新增直升电梯</title>
<link rel="stylesheet" th:href="@{./../../layui/2.3.0/css/layui.css?t=1527693307626}"  media="all">
  </head>
<body>
<form class="layui-form　layui-row" action="" id="addEleForm" method="post">
  <input type="hidden" name="fid" value="${fid}">
  
  <div class="layui-form-item ">
    <label class="layui-form-label">梯种</label>
    <div class="layui-input-inline">
      <select name="meta" class="layui-input">
      	<option value="1">扶梯</option>
      	<option value="2">自动人行步道</option>
      	
      </select>
    </div>
  </div>
 <div class="layui-form-item ">
    <label class="layui-form-label">高度</label>
    <div class="layui-input-inline layui-col-md6 layui-col-md-offset1">
      <input type="number" name="stationNum" lay-verify="required|number"  autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item layui-col-md8 layui-col-md-offset1">
    <label class="layui-form-label">扶手材质</label>
    <div class="layui-input-inline">
      <input type="text" name="carryLoad" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
   <div class="layui-form-item layui-col-md8 layui-col-md-offset1">
    <label class="layui-form-label">角度</label>
    <div class="layui-input-inline">
      <input type="text" name="carryLoad" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
   <div class="layui-form-item layui-col-md8 layui-col-md-offset1">
    <label class="layui-form-label">速度</label>
    <div class="layui-input-inline">
      <input type="text" name="speed" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item layui-col-md8 layui-col-md-offset1">
    <label class="layui-form-label">台数</label>
    <div class="layui-input-inline">
      <input type="number"  name="num" lay-verify="required|number" placeholder="" autocomplete="off" class="layui-input">
    </div>
  </div>
  
  
 <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" id="submitBtn" type="button"lay-filter="demo1">提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
  </form>
 
<script th:src="@{./../../layui/2.3.0/layui.all.js}" charset="utf-8"></script>
  <script >
  var prefix="./../";
  layui.use(['form', 'layedit', 'laydate'], function(){
	  var form = layui.form
	  ,$=layui.jquery
	  ,layer = layui.layer
	  ,layedit = layui.layedit
	  ,laydate = layui.laydate;
	  
	  form.verify({
		    title: function(value){
		      if(value.length < 5){
		        return '标题至少得5个字符啊';
		      }
		    }
		    ,pass: [/(.+){6,12}$/, '密码必须6到12位']
		    ,content: function(value){
		      layedit.sync(editIndex);
		    }
		  });
	  $("#submitBtn").click(function(){
		  $.ajax({
				cache : true,
				type : "POST",
				url : "./elevator/add",
				data : $("#addEleForm").serialize(),// 你的formid
				async : false,
				error : function(request) {
					parent.layer.alert("Connection error");
				},
				success : function(data) {
					if (data["success"]) {
						parent.layer.msg("操作成功");
						parent.reLoad();
						var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
						parent.layer.close(index);

					} else {
						parent.layer.alert(data.msg)
					}

				}
			});
	  });
	  
	//监听提交
	  form.on('submit(demo1)', function(data){
		
	    return false;
	  });
  });
  
  
  
  
  </script>
</body>
</html>